package cn.yunhe.biz;

import java.util.List;

import cn.yunhe.dao.IProvienceMessageDao;
import cn.yunhe.dao.ProvienceMessageDaoImpl;
import cn.yunhe.entity.ProvienceMessage;

public class ProvienceMessageBizImpl implements IProvienceMessageBiz {
	IProvienceMessageDao provienceMessageDao = new ProvienceMessageDaoImpl(); 
	
	public List<ProvienceMessage> searchProvienceMessage(String wri,int pagesize,int currpage) {
		return provienceMessageDao.searchProvienceMessage(wri,pagesize,currpage);
	}

	public int getCount(String wri) {
		return provienceMessageDao.getCount(wri);
	}

	@Override
	public ProvienceMessage selectProById(int pid) {
		// TODO Auto-generated method stub
		return provienceMessageDao.selectProById(pid);
	}

	@Override
	public List<ProvienceMessage> getAllProvince() {
		// TODO Auto-generated method stub
		return provienceMessageDao.getAll();
	}
	public boolean insert(String p_name, String p_date, String p_cont, int p_one, int p_two, String p_wri) {
		Object[] pramas = {p_name,p_date,p_cont,p_one,p_two,p_wri};
		String sql = "insert into PROVINCE_MESSAGE values(user_seq.nextval,?,?,?,?,?,?)";
		int flag = provienceMessageDao.inOrDelOrUp(sql, pramas);
		if(flag>0){
			return true;
		}else{
			return false;
		}
	}

	@Override
	public boolean del(int id) {
		Object[] pramas = {id};
		String sql = "delete from PROVINCE_MESSAGE where p_id = ?";
		int flag = provienceMessageDao.inOrDelOrUp(sql, pramas);
		if(flag>0){
			return true;
		}else{
			return false;
		}
	}

	@Override
	public boolean update(int p_id, String p_name, String p_date, String p_cont, int p_one, int p_two, String p_wri,int id) {
		Object[] pramas = {p_id,p_name,p_date,p_cont,p_one,p_two,p_wri,id};
		String sql = "update PROVINCE_MESSAGE set p_id = ?,p_name=?,p_date = ?,p_cont = ?,p_one = ?,p_two = ?,p_wri = ? where p_id = ?";
		int flag = provienceMessageDao.inOrDelOrUp(sql, pramas);
		if(flag>0){
			return true;
		}else{
			return false;
		}
	}

	

}
